package cn.zyb.feignclient;


import cn.zyb.domain.User;
import cn.zyb.util.Result;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MovieFeignClientFallbackFactory implements FallbackFactory<MovieFeignClient> {

    @Override
    public MovieFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new MovieFeignClient(){

            @Override
            public Result addOneTicket(User user) {
                return new Result(false, "触发熔断!用户服务不可用！",null);
            }
        };

    }
}
